package xzy.com.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import xzy.com.entity.vo.ResponseBean;


@RestControllerAdvice
public class GlobalExceptionHandler {
	@ResponseBody
	@ExceptionHandler(Exception.class)
	public ResponseBean handleException(Exception e) {
		String msg = e.getMessage();
		if (msg == null || msg.equals("")) {
			msg = "服务器出错";
		}
		ResponseBean jsonObject = new ResponseBean(-1,msg,null);		
		return jsonObject;
	}
}
